package com.example.lib.muchthread;

/**
 * 单例设计模式
 * <p>
 * 饿汉式
 * class Single{
 * private static final Single s=new Single();
 * private Single(){}
 * <p>
 * public static Single getInstance(){
 * return s;
 * }
 * }
 * <p>
 * 懒汉式  (有多线程的问题)
 * class Single{
 * private static Single s=null;
 * private Single(){}
 * public static Single getInstance(){
 * if(s==null){
 * s=new Single();
 * }
 * return s;
 * }
 * }
 */

class Single140 {
    private static Single140 s = null;

    private Single140() {
    }

    public static Single140 getInstance() {
        if (s == null) {
            synchronized (Single140.class) {
                if (s == null) {
                    s = new Single140();
                }
            }
        }
        return s;
    }
}

public class k_singleinstance_140 {


}
